local jiezi = fk.CreateSkill{
  name = "iberia__jiezi_active",
}

Fk:loadTranslationTable{
  [jiezi.name] = "截辎"
}

local I = require "packages/iberia/utility"

jiezi:addEffect("active", {
  mute = true,
  can_use = Util.FalseFunc,
  interaction = function (self, player)
    return S.DoubleComboBox { all_choices = self.all_choices, choices = self.choices }
  end,
  card_filter = function (self, player, to_select, selected)
    return #selected == 0 and Fk:getCardById(to_select).trueName == "jink"
    and not player:prohibitResponse(Fk:getCardById(to_select))
  end,
  feasible = function (self, player, selected, selected_cards)
    local choosed = string.split(self.interaction.data, ",")
    if choosed[1] == choosed[2] then return false end
    if table.contains(choosed, self.all_choices[1]) then
      return #selected_cards == 1
    else
      return #selected_cards == 0
    end
  end,
})

return jiezi